<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<style type="text/css">
       #box{
           width: 500px;
           margin: 0 auto;
           margin-top: 100px;
           border: 1px solid #f65;
           height: 400px;
           text-align:center;
       }
       .sbox{
       	    width: 100px;
       	    height: 100px;
       	    background: #ccc;
       	    margin: 0 auto;
       }
	</style>
</head>
<body>
	<div id="box">
	   <input type="button" onclick="changeWith()" value="变宽">
	   <input type="button" onclick="changeHeight()" value="变高">
	   <input type="button" onclick="changeColor()" value="变色">
	   <input type="button" onclick="changeConceal()" value="隐藏">
	   <input type="button" onclick="changeReset()" value="重置">
	   <div class="sbox" id="ff">
	   	
	   </div>
	</div>
</body>
<script type="text/javascript">
	function changeWith() {

		var Osbox = document.getElementsByClassName("sbox");
		//dd.setAttribute("style","width:300px");
		// var Osbox = document.getElementsByClassName("sbox");
		
		Osbox[0].style.width = "300px";
		//Osbox[0].style.width = "200";
	}
	function changeHeight() {
		var Osbox = document.getElementsByClassName("sbox");
		Osbox[0].style.height = "300px";
	}
	function changeColor() {
		var Osbox = document.getElementsByClassName("sbox");
		Osbox[0].style.backgroundColor = "#f90";
	}
	function changeConceal() {
		var Osbox = document.getElementsByClassName("sbox");
		Osbox[0].style.display = "none";
	}
	function changeReset() {
		var Osbox = document.getElementsByClassName("sbox");
		Osbox[0].style.cssText = "";
	}
</script>
</html>